package com.epam.entity;

public class Purchase extends AbstractEntity {
		
	private int purchaseId;
	private int userId;
	private int voucherId;
	private String date;
	
	public Purchase() {
	}
	
	public Purchase(PurchaseBuilder builder) {
		this.purchaseId = builder.purchaseId;
		this.userId = builder.userId;
		this.voucherId = builder.voucherId;
		this.date = builder.date;
	}
	
	public static class PurchaseBuilder {
		private int purchaseId;
		private int userId;
		private int voucherId;
		private String date;
		
		public PurchaseBuilder() {
		}
		
		public PurchaseBuilder purchaseId(int purchaseId) {
			this.purchaseId = purchaseId;
			return this;
		}
		
		public PurchaseBuilder userId(int userId) {
			this.userId = userId;
			return this;
		}
		
		public PurchaseBuilder voucherId(int voucherId) {
			this.voucherId = voucherId;
			return this;
		}
		
		public PurchaseBuilder date(String date) {
			this.date = date;
			return this;
		}
		
		public Purchase build() {
			return new Purchase(this);
		}
		
	}

	public int getPurchaseId() {
		return purchaseId;
	}

	public void setPurchaseId(int purchaseId) {
		this.purchaseId = purchaseId;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public int getVoucherId() {
		return voucherId;
	}

	public void setVoucherId(int voucherId) {
		this.voucherId = voucherId;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String toString(Purchase purchase) {
		String result = "Purchase ID: " + purchase.getPurchaseId() + "; User ID: " + purchase.getUserId() + "; Voucher ID: " + purchase.getVoucherId();
		return result;
	}
	
}
